<div id="<?php echo WacModuleHelper::getListingTableId($invokeParams['moduleName'],$invokeParams['attachName']);?>">

    <div style="font-size:12px;"></div>
    <br />

    <table id="<?php echo WacModuleHelper::getListId($invokeParams['moduleName'],$invokeParams['attachName']); ?>"></table>
    <div id="<?php echo WacModuleHelper::getPagerId($invokeParams['moduleName'],$invokeParams['attachName']); ?>" ></div>

    <script type="text/javascript">
        //<![CDATA[
        jQuery("#<?php echo WacModuleHelper::getListId($invokeParams['moduleName'],$invokeParams['attachName']); ?>").jqGrid({
            datatype: "json",
            url: BASE_URL+"<?php echo $invokeParams['moduleName']; ?>/<?php echo $invokeParams['method']; ?>",
            editurl: "<?php echo $invokeParams['moduleName']; ?>/doOperation",
            postData: {dataFormat: "json"},
            colNames:['id','订单号', '编号', '客户', '当前流程', '产品', '数量', '货物单位', '总价值', '总成本',
                '货币单位', '开始日', '起货日', '制单人', '审批者', '审批时间', '状态', '备注','建立时间',
                'ch1',

        <?php
            echo WacModuleHelper::generateJqGridHiddenFields($invokeParams['objMainModuleTableFields']);
        ?>
                '操作' ],
            colModel:[
                {
                    name:'id',
                    index:'id',
                    editable:false,
                    hidden:true,
                    width:25
                },
                {
                    name:'customer_order_code',
                    index:'customer_order_code',
                    width:100
                },
                {
                    name:'code',
                    index:'code',
                    editable:true,
                    formoptions:{elmsuffix:"(*)"},
                    editrules:{required:true},
                    width:100,
                    align:"left"
                },
                {
                    name:'customer_name',
                    index:'customer_name',
                    editable:true,
                    width:150,
                    align:"center",
                    edittype:"select",
                    editoptions: {
                        dataUrl:BASE_URL+"customer/getIdNameHashHTML?dataFormat=html"
                    }
                },
                {
                    name:'current_workflow_item_name',
                    index:'current_workflow_item_name',
                    editable:false,
                    width:100
                },
                {
                    name:'goods_name',
                    index:'goods_name',
                    editable:true,
                    width:120
                },
                {
                    name:'goods_amount',
                    index:'goods_amount',
                    editable:true,
                    width:100
                },
                {
                    name:'goods_amount_unit_code_name',
                    index:'goods_amount_unit_code_name',
                    editable:true,
                    width:80,
                    align:"center",
                    edittype:"select",
                    editoptions: {
                        dataUrl:BASE_URL+"unit/getCodeNameHashHTML?dataFormat=html"
                    }
                },
                {
                    name:'goods_amount_price',
                    index:'goods_amount_price',
                    editable:true,
                    width:100
                },
                {
                    name:'cost_amount',
                    index:'cost_amount',
                    editable:true,
                    width:100
                },
                {
                    name:'currency_code_name',
                    index:'currency_code_name',
                    editable:false,
                    width:80
                },
                {
                    name:'start_date',
                    index:'start_date',
                    editable:true,
                    width:100
                },
                {
                    name:'delivery_date',
                    index:'delivery_date',
                    editable:true,
                    width:100
                },
                {
                    name:'maker_name',
                    index:'maker_name',
                    editable:true,
                    width:100
                },
                {
                    name:'auditor_name',
                    index:'auditor_name',
                    editable:true,
                    width:100
                },
                {
                    name:'auditor_date',
                    index:'auditor_date',
                    editable:true,
                    width:100
                },
                {
                    name:'status_name',
                    index:'status_name',
                    editable:false,
                    width:100
                },
                {
                    name:'memo',
                    sortable:false,
                    editable:true,
                    width:100,
                    edittype:"textarea",
                    editoptions:{rows:"2",cols:"10"},
                    align:"center"
                },
                {
                    name:'created_at',
                    index:'created_at',
                    sorttype:'date',
                    datefmt:'Y-m-d',
                    width:200,
                    editable:false,
                    align:"center"
                },
                {name:'goods_category_id', editable:false, hidden:true},
                
       <?php
            echo WacModuleHelper::generateJqGridHiddenFields($invokeParams['objMainModuleTableFields'], true);
       ?>
                {
                    name:'act',
                    index:'act',
                    width:250,
                    editable:false,
                    sortable:false,
                    align:"center"
                }
            ],
            jsonReader : {
                root:"items",
                page: "currentPage",
                total: "totalPages",
                records: "totalRecords",
                userdata: "userdata",
                id: "id",
                repeatitems: false
            },
            rowNum:10,
            rowList:[10,20,30,40,50],
            sortname: 'id',
            sortorder: "desc",
            multiselect: false,
            viewrecords: true,
            pager: '#<?php echo WacModuleHelper::getPagerId($invokeParams['moduleName'],$invokeParams['attachName']); ?>',
            caption:"<?php echo $invokeParams['caption']; ?>列表",
            height: '100%',
            width: '100%',

            gridComplete: function(){
                var ids = jQuery("#<?php echo WacModuleHelper::getListId($invokeParams['moduleName'],$invokeParams['attachName']); ?>").jqGrid('getDataIDs');
                var editUrl = BASE_URL + "<?php echo $invokeParams['moduleName']; ?>/edit";
                var delUrl = BASE_URL + "<?php echo $invokeParams['moduleName']; ?>/delete";
                for(var i=0;i < ids.length;i++){
                    var cl = ids[i];
<?php echo WacModuleHelper::generateListViewFormBtn($invokeParams['moduleName'],$invokeParams['attachName']);?>     // bv
                    <?php echo WacModuleHelper::generateListAuditFormBtn($invokeParams['moduleName'],$invokeParams['attachName']);?>    // ba
                    <?php echo WacModuleHelper::generateListAddSubFormBtn($invokeParams['subItemModuleName'],$invokeParams['attachName']);?>    // sa
                    <?php echo WacModuleHelper::generateListEditFormBtn($invokeParams['moduleName'],$invokeParams['attachName']);?>    // be
                    <?php echo WacModuleHelper::generateListDelFormBtn($invokeParams['moduleName'],$invokeParams['attachName']);?>    // de

                    <?php echo WacModuleHelper::generateListBtns($invokeParams['moduleName'], $invokeParams['subItemModuleName'], $invokeParams['attachName'], array('bv','ba','be','de'));?>
                    }
              },

                            loadError : function(xhr,st,err){
                                alert("Type: "+st+"; Response: "+ xhr.status + " "+xhr.statusText);
                            },

                            loadComplete: function()
                            {
                                //        console.log($.dump($("#<?php echo WacModuleHelper::getListId($invokeParams['moduleName'],$invokeParams['attachName']); ?>").jqGrid('getGridParam', 'userData')));
//                                        wacDebugLog("loadComplete");
                                $(this).trigger("tabsload");   // inform tabs event listener
                            }

                        });
                        jQuery("#<?php echo WacModuleHelper::getListId($invokeParams['moduleName'],$invokeParams['attachName']); ?>").jqGrid('navGrid','#<?php echo WacModuleHelper::getPagerId($invokeParams['moduleName'],$invokeParams['attachName']); ?>',
                        {edit:false, add:false, del:false, search:true, refresh:true, view:false, position:"left"},
                        {afterSubmit: <?php echo $invokeParams['moduleName'].$invokeParams['attachName']; ?>CallbackValidate, afterComplete: <?php echo $invokeParams['moduleName'].$invokeParams['attachName']; ?>CallbackEdit},
                        {afterSubmit: <?php echo $invokeParams['moduleName'].$invokeParams['attachName']; ?>CallbackValidate, afterComplete: <?php echo $invokeParams['moduleName'].$invokeParams['attachName']; ?>CallbackAdd},
                        {afterComplete: <?php echo $invokeParams['moduleName'].$invokeParams['attachName']; ?>CallbackDel},
                        {afterComplete: <?php echo $invokeParams['moduleName'].$invokeParams['attachName']; ?>CallbackSearch},
                        {afterComplete: <?php echo $invokeParams['moduleName'].$invokeParams['attachName']; ?>CallbackView}
                    );

                        function <?php echo $invokeParams['moduleName'].$invokeParams['attachName']; ?>CallbackValidate(response, postdata)
                        {
                            //    console.log("callbackEdit");

                            wacAjaxData.response = eval('(' + response.responseText + ')');
                            //    console.log($.dump(wacAjaxData.response));
                            //    console.log($.dump(postdata));

                            if(wacAjaxData.response.userdata.status == wacOperationStatus.Succss)
                            {
                                return [true, "", ""];
                            }
                            else
                            {
                                return [false, wacAjaxData.response.userdata.error_info];
                            }
                        }

                        function <?php echo $invokeParams['moduleName'].$invokeParams['attachName']; ?>CallbackSave(response)
                        {
                            //    alert("callbackSave");
                            //    console.log("callbackSave");
                            //    console.log($.dump($("#<?php echo WacModuleHelper::getListId($invokeParams['moduleName'],$invokeParams['attachName']); ?>").jqGrid('getGridParam', 'userData')));
                            //    console.log(response.responseText);
                            wacAjaxData.response = eval('(' + response.responseText + ')');
                            if(wacAjaxData.response.userdata.status == wacOperationStatus.Succss)
                            {
                                return true;
                            }
                            else
                            {
                                showTips(wacAjaxData.response.userdata.error_info);
                                return [false, wacAjaxData.response.userdata.error_info];
                            }
                        }

                        function <?php echo $invokeParams['moduleName'].$invokeParams['attachName']; ?>CallbackEdit()
                        {
                            //    alert("callbackEdit");
                            //    console.log("callbackEdit");
                        }

                        function <?php echo $invokeParams['moduleName'].$invokeParams['attachName']; ?>CallbackAdd()
                        {
                            //    alert("callbackAdd");
                            //    console.log("callbackAdd");
                        }

                        function <?php echo $invokeParams['moduleName'].$invokeParams['attachName']; ?>CallbackDel()
                        {
                            //    alert("callbackDel");
                            //    console.log("callbackDel");
                        }

                        function <?php echo $invokeParams['moduleName'].$invokeParams['attachName']; ?>CallbackSearch()
                        {
                            //    alert("callbackSearch");
                            //    console.log("callbackSearch");
                        }

                        function <?php echo $invokeParams['moduleName'].$invokeParams['attachName']; ?>CallbackView()
                        {
                            //    alert("callbackView");
                            //    console.log("callbackView");
                        }

                        function <?php echo $invokeParams['moduleName'].$invokeParams['attachName']; ?>FormValidate(postdata, formid)
                        {
                            $result = [];
                            $.getJSON(
                            BASE_URL+"<?php echo $invokeParams['moduleName']; ?>/validate",
                            postdata,
                            function(jsonData){
                                wacOperationStatus.Processing = true;
<?php echo $invokeParams['moduleName'].$invokeParams['attachName']; ?>FormValidateCallBack(jsonData);
                        }
                    );

                        $(".loading").css("display", "block");

                        if(wacAjaxData.response.userdata.status == wacOperationStatus.Succss)
                        {
                            return [true];
                        }
                        else
                        {
                            return [false, wacAjaxData.response.userdata.error_info];
                        }

                        //    console.log($.dump(postdata));

                    }

                    function <?php echo $invokeParams['moduleName'].$invokeParams['attachName']; ?>FormValidateCallBack(jsonData)
                    {
                        wacAjaxData.response = jsonData;
                        wacOperationStatus.Processing = false;
                        $(".loading").css("display", "none");
                        //    console.log($.dump(jsonData));
                    }
                    //]]>
    </script>

    <br /><br />

</div>